package cn.tradewin.advisor.pages.master;

import java.util.List;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.beaneditor.BeanModel;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.BeanModelSource;

import cn.tradewin.advisor.persist.model.Advcalendar;
import cn.tradewin.advisor.persist.services.CalendarService;

public class Calendar {
	
	@Property
	private Advcalendar calendar;
	
	@Property
	private List<Advcalendar> calendars;
	
	@Inject
	private BeanModelSource beanModelSource;
	
	@Property
	private BeanModel<Advcalendar> beanModel;
	
	@Inject
	private Messages messages;
	
	@Inject
	private CalendarService calendarService;
	
	void setupRender() {
		beanModel = beanModelSource.createDisplayModel(Advcalendar.class, messages);
		beanModel.add("action", null);
		beanModel.include("id", "name", "localeName","year", "startTime", "endTime", "action");
		beanModel.get("id").sortable(false);
		beanModel.get("name").sortable(false);
		beanModel.get("startTime").sortable(false);
		beanModel.get("endTime").sortable(false);
		beanModel.get("action").sortable(false);
		calendars = calendarService.getCalendars();
	}
}